#pragma once
#include <iostream>
#include <unistd.h>
#include<cerrno>
#include <fcntl.h>
#include"Log.hpp"
void SetNoneBlock(const int fd)
{
    int f1 = fcntl(fd, F_GETFL);
    if (f1 < 0)
    {
        std::cerr << "fcntl failed" << std::endl;
        exit(0);
    }
    lg.LogMessage(Info, "set fd: %d unblock\n", fd);
    fcntl(fd, F_SETFL, f1 | O_NONBLOCK);
}